perm filename MANUAL.MF[FIG,DEK]1 blob
sn#772253 filedate 1984-10-23 generic text, type C, neo UTF8
COMMENT ā VALID 00036 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00005 00002 % This file generates most of the figures for The METAFONTbook
C00006 00003 "Figure 2a" % 6 points and a grid
C00008 00004 "Figure A2a" % 6 points and a grid and two more points
C00010 00005 "Figure 2b" % 6 points and a line
C00011 00006 "Figure 2c" % 6 points and three lines (hex symbol, version 1)
C00012 00007 "Figure 2d" % hex symbols with top and bottom adjusted
C00014 00008 "Figure 2e" % stick-letter A
C00015 00009 "Figure 3a" % 4 points and 3 midpoints
C00016 00010 "Figure 3b" % 4 points and 6 midpoints
C00018 00011 "Figure 3c" % 4 points and infinitely many midpoints
C00020 00012 "Figure 3d" % 4 points and various cubics
C00022 00013 "Figure 3e" % example curves with automatic control points
C00024 00014 "Figure 3f" % bean shape with automatic control points
C00025 00015 "Figure 3g" % bean shape with more tension between 1 and 3
C00026 00016 "Figure 3h" % bean shape with more tension before and after 1
C00027 00017 "Figure 3i" % bean shape with straight bottom
C00028 00018 "Figure 3j" % example with direction specified
C00029 00019 "Figure 3k" % wiggly shape for exercise
C00030 00020 "Figure 3l" % examples of varying curl
C00032 00021 "Figure 3m" % two directions specified
C00033 00022 "Figure 3n" % two control points specified
C00034 00023 "Figure 4a" % bean shape with elliptical pens
C00036 00024 "Figure 4b" % T of METAFONT logo
C00038 00025 "Figure 4c" % M of METAFONT logo
C00040 00026 "Figure 4d" % solid kidney bean
C00041 00027 "Figure 4e" % black triangle character for exercises
C00042 00028 "Figure 4f" % black bean with white holes
C00043 00029 "Figure 4g" % black bean with skewed interior cutout
C00045 00030 "Figure 4h" % sample penstroke
C00046 00031 "Figure 4i" % cyclic penstroke example
C00047 00032 "Figure 4j" % T from IOnian font
C00049 00033 "Figure 4k" % fixed pens versus penstrokes
C00050 00034 "Figure 4l" % hex symbol with pen-pressure adjustments
C00052 00035 "Figure 4m" % same, cut sharp at the terminals, and inside the box
C00054 00036 "Figure A5a" % S from IOnian font
C00056 ENDMK
Cā;
% This file generates most of the figures for The METAFONTbook
def clear_all = clearit; clearxy; pickup standardpen;
proofrulethickness 0;
enddef;
def heavy_dot expr z =
makelabel.top("",z-(1,0));
makelabel.top("",z+(1,0));
makelabel.top("",z-(0,1));
makelabel.top("",z+(0,1));
makelabel.top("",z+(1,1)/sqrt2);
makelabel.top("",z+(1,-1)/sqrt2);
makelabel.top("",z-(1,1)/sqrt2);
makelabel.top("",z-(1,-1)/sqrt2);
enddef;
mode=proof; mode_setup;
standardpen=savepen;
"Figure 2a"; % 6 points and a grid
clear_all;
pair offset; offset=(.5,.5);
z1=(0,100)+offset;
z2=(100,100)+offset;
z3=(200,100)+offset;
z4=(0,0)+offset;
z5=(100,0)+offset;
z6=(200,0)+offset;
proofrulethickness .8;
proofrule (z1+(0,5),z4-(0,5)); proofrule (z4-(5,0),z6+(5,0));
makelabel.top("1 ",z1);
makelabel.top("2 ",z2);
makelabel.top("3 ",z3);
makelabel.bot("4 ",z4);
makelabel.bot("5 ",z5);
makelabel.bot("6 ",z6);
for k=1 upto 6: heavy_dot z[k]; endfor;
pickup pencircle;
for x=10 step 10 until 200: draw (x,-5)+offset..(x,105)+offset; endfor
for y=10 step 10 until 100: draw (-5,y)+offset..(205,y)+offset; endfor
showit;
shipit;
"Figure A2a"; % 6 points and a grid and two more points
clear_all;
proofoffset(30,0);
pair offset; offset=(.5,.5);
z1=(0,100)+offset;
z2=(100,100)+offset;
z3=(200,100)+offset;
z4=(0,0)+offset;
z5=(100,0)+offset;
z6=(200,0)+offset;
proofrulethickness .8;
proofrule (z1+(0,5),z4-(0,5)); proofrule (z4-(5,0),z6+(5,0));
makelabel.top("1 ",z1);
makelabel.top("2 ",z2);
makelabel.top("3 ",z3);
makelabel.bot("4 ",z4);
makelabel.bot("5 ",z5);
makelabel.bot("6 ",z6);
for k=1 upto 6: heavy_dot z[k]; endfor;
makelabel.lft("(-5,15)",(-5,15)+offset);
%makelabel.top("(60,30) ",(60,30)+offset);
makelabel.top(" ,30) ",(60,30)+offset);
makelabel.top("(60 ",(60,30)+offset);
heavy_dot (-5,15)+offset;
heavy_dot (60,30)+offset;
pickup pencircle;
for x=10 step 10 until 200: draw (x,-5)+offset..(x,105)+offset; endfor
for y=10 step 10 until 100: draw (-5,y)+offset..(205,y)+offset; endfor
showit;
shipit;
"Figure 2b"; % 6 points and a line
clear_all;
z1=(0,100);
z2=(100,100);
z3=(200,100);
z4=(0,0);
z5=(100,0);
z6=(200,0);
draw (x1-epsilon,y1)..(x6,y6);
makelabel.lft("1 ",z1);
makelabel.lft("2",z2);
makelabel.rt("3",z3);
makelabel.lft("4",z4);
makelabel.lft("5",z5);
makelabel.rt(" 6",z6);
showit;
shipit;
"Figure 2c"; % 6 points and three lines (hex symbol, version 1)
clear_all;
z1=(0,100);
z2=(100,100);
z3=(200,100);
z4=(0,0);
z5=(100,0);
z6=(200,0);
draw z1..z6; draw z2..z5; draw z3..z4;
for k=1 upto 6: filldot z[k]; endfor
makelabel.lft("1 ",z1);
makelabel.lft("2 ",z2);
makelabel.rt(" 3",z3);
makelabel.lft("4 ",z4);
makelabel.lft("5 ",z5);
makelabel.rt(" 6",z6);
showit;
shipit;
"Figure 2d"; % hex symbols with top and bottom adjusted
clear_all;
top z1=(0,100);
top z2=(100,100);
top z3=(200,100);
bot z4=(0,0);
bot z5=(100,0);
bot z6=(200,0);
draw z1..z6; draw z2..z5; draw z3..z4;
for k=1 upto 6: filldot z[k]; endfor
makelabel.lft("1 ",z1);
makelabel.lft("2 ",z2);
makelabel.rt(" 3",z3);
makelabel.lft("4 ",z4);
makelabel.lft("5 ",z5);
makelabel.rt(" 6",z6);
showit;
clearxy; pair offset; offset=(250,0);
pickup pencircle scaled .6pt;
top z1=(0,100)+offset;
top z2=(100,100)+offset;
top z3=(200,100)+offset;
bot z4=(0,0)+offset;
bot z5=(100,0)+offset;
bot z6=(200,0)+offset;
draw z1..z6; draw z2..z5; draw z3..z4;
for k=1 upto 6: filldot z[k]; endfor
makelabel.lft("1 ",z1);
makelabel.lft("2 ",z2);
makelabel.rt(" 3",z3);
makelabel.lft("4 ",z4);
makelabel.lft("5 ",z5);
makelabel.rt(" 6",z6);
proofrule ((-5,100),(210,100)+offset);
proofrule ((-5,0),(210,0)+offset);
showit;
shipit;
"Figure 2e"; % stick-letter A
b#:=250/36pt#; a#:=150/36pt#; s#:=30/36pt#;
define_pixels(b,a,s);
def A(expr alpha)=
beginchar (incr(charcode),s#+a#+s#,b#,0);
pickup standardpen;
bot z1=(good.x s,0); z5=z1+(a,0);
z3=(1/2[x1,x5],good.y b);
z2=alpha[z1,z3]; z4=alpha[z5,z3];
draw z1..z3; draw z3..z5; draw z2..z4;
filldot z1; filldot z5; filldot z3;
makelabel.lft("1 ",z1);
makelabel.lft("2 ",z2);
makelabel.top("3 ",z3);
makelabel.rt(" 4",z4);
makelabel.rt(" 5",z5);
endchar; enddef;
A((3-sqrt5)/2); % (area above bar / area below) = golden ratio
"Figure 3a"; % 4 points and 3 midpoints
clear_all;
z1=(.5,.5); z2=(40.5,80.5); z3=(150.5,100.5); z4=(300.5,.5);
z12=1/2[z1,z2]; z23=1/2[z2,z3]; z34=1/2[z3,z4];
pickup pencircle;
draw z1--z2--z3--z4;
heavy_dot z1; heavy_dot z2; heavy_dot z3; heavy_dot z4;
makelabel.lft("1",z1);
makelabel.lft("2",z2);
makelabel.top(" 3",z3);
makelabel.rt("4",z4);
makelabel.rt("12",z12);
makelabel.bot(" 23",z23);
makelabel.bot("34 ",z34);
showit;
shipit;
"Figure 3b"; % 4 points and 6 midpoints
clear_all;
z1=(.5,.5); z2=(40.5,80.5); z3=(150.5,100.5); z4=(300.5,.5);
z12=1/2[z1,z2]; z23=1/2[z2,z3]; z34=1/2[z3,z4];
z123=1/2[z12,z23]; z234=1/2[z23,z34]; z1234=1/2[z123,z234];
heavy_dot z1; heavy_dot z2; heavy_dot z3; heavy_dot z4;
pickup pencircle;
draw z1--z2--z3--z4; draw z12--z23--z34; draw z123--z234;
makelabel.lft("1",z1);
makelabel.lft("2",z2);
makelabel.top(" 3",z3);
makelabel.rt("4",z4);
makelabel.lft("12",z12);
makelabel.top("23 ",z23);
makelabel.rt("34",z34);
makelabel.bot(" 123",z123);
makelabel.bot("234 ",z234);
makelabel.bot("1234",z1234);
showit;
shipit;
"Figure 3c"; % 4 points and infinitely many midpoints
clear_all;
z1=(.5,.5); z2=(40.5,80.5); z3=(150.5,100.5); z4=(300.5,.5);
heavy_dot z1; heavy_dot z2; heavy_dot z3; heavy_dot z4;
pickup pencircle;
def makedot(expr x)= special " 1";
numspecial xpart x; numspecial ypart x enddef;
def recurse(expr a,b,c,d)=
dist:=abs(a-d);
if dist>4:
begingroup save e,f,g,h,i,j; pair e,f,g,h,i,j;
e=(a+b)/2; makedot(e);
f=(b+c)/2; makedot(f);
g=(c+d)/2; makedot(g);
h=(e+f)/2; makedot(h);
i=(f+g)/2; makedot(i);
j=(h+i)/2; makedot(j);
if dist>20: draw a--b--c--d; draw e--f--g; draw h--i; fi
recurse(a,e,h,j); recurse(j,i,g,d);
endgroup;
fi enddef;
makedot(z1); makedot(z2); makedot(z3); makedot(z4); recurse(z1,z2,z3,z4);
shipit;
"Figure 3d"; % 4 points and various cubics
clear_all;
z1=(0,0); z2=5/6(40,80); z3=5/6(150,100); z4=5/6(300,0);
draw z1..controls z2 and z3..z4;
filldot z1; filldot z4;
makelabel.lft("1 ",z1);
makelabel.lft("2",z2);
makelabel.rt("3",z3);
makelabel.rt(" 4",z4);
pair offset; offset:=(325,0);
draw (z1..controls z3 and z2..z4) shifted offset;
filldot z1+offset; filldot z4+offset;
makelabel.lft("1 ",z1+offset);
makelabel.lft("3",z2+offset);
makelabel.rt("2",z3+offset);
makelabel.rt(" 4",z4+offset);
offset:=(0,-100);
draw (z2..controls z1 and z3..z4) shifted offset;
filldot z2+offset; filldot z4+offset;
makelabel.lft("2",z1+offset);
makelabel.lft("1 ",z2+offset);
makelabel.rt("3",z3+offset);
makelabel.rt(" 4",z4+offset);
offset:=(325,-100);
draw (z1..controls z4 and z2..z3) shifted offset;
filldot z1+offset; filldot z3+offset;
makelabel.lft("1 ",z1+offset);
makelabel.lft("3",z2+offset);
makelabel.rt(" 4",z3+offset);
makelabel.rt("2",z4+offset);
showit;
shipit;
"Figure 3e"; % example curves with automatic control points
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z4..z1..z2..z6;
draw p;
filldot z4; filldot z6;
makelabel.bot.nodot(" 1",z1);
makelabel.top.nodot(" 2",z2);
makelabel.rt.nodot("3",z3+(2,0));
makelabel.rt.nodot(" 4",z4);
makelabel.rt.nodot("5",z5+(2,0));
makelabel.rt.nodot(" 6",z6);
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
pair offset; offset=(325,0);
p:=(z5..z4..z1..z3..z6..z5) shifted offset; draw p;
filldot z5+offset;
makelabel.bot.nodot(" 1",z1+offset);
makelabel.top.nodot("2",z2+offset+(0,2));
makelabel.bot.nodot("3 ",z3+offset);
makelabel.top.nodot(" 4",z4+offset);
makelabel.top.nodot("5",z5+offset+(0,5));
makelabel.top.nodot("6 ",z6+offset);
for k=1 upto 6: heavy_dot z[k]+offset; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3f"; % bean shape with automatic control points
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..z1..z3..z6..cycle;
draw p;
makelabel.bot.nodot(" 1",z1);
makelabel.bot.nodot("2",z2-(0,2));
makelabel.bot.nodot("3 ",z3);
makelabel.top.nodot(" 4",z4+(-1,1));
makelabel.top.nodot("5",z5+(0,5));
makelabel.top.nodot("6 ",z6+(1,1));
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3g"; % bean shape with more tension between 1 and 3
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..z1..tension1.2..z3..z6..cycle;
draw p;
makelabel.bot.nodot(" 1",z1);
makelabel.bot.nodot("2",z2-(0,2));
makelabel.bot.nodot("3 ",z3);
makelabel.top.nodot(" 4",z4+(-1,1));
makelabel.top.nodot("5",z5+(0,5));
makelabel.top.nodot("6 ",z6+(1,1));
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3h"; % bean shape with more tension before and after 1
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..tension 1 and 1.5..z1..tension 1.5 and 1..z3..z6..cycle;
draw p;
makelabel.bot.nodot(" 1",z1);
makelabel.bot.nodot("2",z2-(0,2));
makelabel.bot.nodot("3 ",z3);
makelabel.top.nodot(" 4",z4+(-1,1));
makelabel.top.nodot("5",z5+(0,5));
makelabel.top.nodot("6 ",z6+(1,1));
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3i"; % bean shape with straight bottom
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4{left}..z1..z3..z6{left}..cycle;
draw p;
makelabel.bot.nodot(" 1",z1-(1,1));
makelabel.bot.nodot("2",z2-(0,2));
makelabel.bot.nodot("3 ",z3+(1,-1));
makelabel.top.nodot(" 4",z4+(0,5));
makelabel.top.nodot("5",z5+(0,5));
makelabel.top.nodot("6 ",z6+(0,5));
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3j"; % example with direction specified
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z4..z2{z3-z4}..z3;
draw p;
makelabel.rt.nodot("1",z1+(0,-9));
makelabel.rt.nodot("2",z2+(1,-11));
makelabel.rt.nodot("3",z3+(1,-11));
makelabel.rt.nodot("4",z4+(1,-11));
makelabel.rt.nodot("5",z5+(0,-9));
makelabel.rt.nodot("6",z6+(0,-9));
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3k"; % wiggly shape for exercise
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4{z4-z2}..z1..z3..z6{z2-z6}..cycle;
draw p;
makelabel.bot.nodot(" 1",z1-(2,2));
makelabel.bot.nodot("2",z2-(0,2));
makelabel.bot.nodot("3 ",z3+(2,-2));
makelabel.bot.nodot(" 4",z4);
makelabel.top.nodot("5",z5+(0,5));
makelabel.bot.nodot("6 ",z6);
for k=1 upto 6: heavy_dot z[k]; endfor;
showit;
shipit;
"Figure 3l"; % examples of varying curl
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z4{curl0}..z2{z3-z4}..{curl0}z3;
draw p;
filldot z4; filldot z3;
makelabel.rt.nodot("1",z1+(0,-9));
makelabel.rt.nodot("2",z2+(1,-11));
makelabel.rt.nodot("3",z3+(1,-11));
makelabel.rt.nodot("4",z4+(1,-11));
makelabel.rt.nodot("5",z5+(0,-9));
makelabel.rt.nodot("6",z6+(0,-9));
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
pair offset; offset=(325,0);
p:=(z4{curl2}..z2{z3-z4}..{curl2}z3) shifted offset; draw p;
filldot z4+offset; filldot z3+offset;
makelabel.rt.nodot("1",z1+(0,-9)+offset);
makelabel.rt.nodot("2",z2+(1,-11)+offset);
makelabel.rt.nodot("3",z3+(1,-11)+offset);
makelabel.rt.nodot("4",z4+(1,-11)+offset);
makelabel.rt.nodot("5",z5+(0,-9)+offset);
makelabel.rt.nodot("6",z6+(0,-9)+offset);
for k=1 upto 6: heavy_dot z[k]+offset; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3m"; % two directions specified
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z4{z2-z4}..z6{down};
draw p;
filldot z4; filldot z6;
makelabel.rt.nodot("1",z1+(2,0));
makelabel.rt.nodot("2",z2+(2,0));
makelabel.rt.nodot("3",z3+(2,0));
makelabel.bot.nodot(" 4",z4);
makelabel.rt.nodot("5",z5+(2,0));
makelabel.rt.nodot(" 6",z6);
for k=1 upto 6: heavy_dot z[k]; endfor;
for k=1 upto length p: heavy_dot postcontrol k-1 of p;
heavy_dot precontrol k of p; endfor
showit;
shipit;
"Figure 3n"; % two control points specified
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z4..controls z1 and z2..z6;
draw p;
filldot z4; filldot z6;
makelabel.rt.nodot("1",z1+(2,0));
makelabel.rt.nodot("2",z2+(2,0));
makelabel.rt.nodot("3",z3+(2,0));
makelabel.rt.nodot(" 4",z4);
makelabel.rt.nodot("5",z5+(2,0));
makelabel.rt.nodot(" 6",z6);
for k=1 upto 6: heavy_dot z[k]; endfor;
showit;
shipit;
"Figure 4a"; % bean shape with elliptical pens
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..z1..z3..z6..cycle;
pickup pencircle xscaled .8pt yscaled .2pt rotated 30;
draw p;
makelabel.bot(" 1",z1);
makelabel.bot("2",z2);
makelabel.bot(" 3",z3);
makelabel.top("4 ",z4);
makelabel.top("",z5); makelabel.top.nodot("5",z5+(0,5));
makelabel.top("",z6); makelabel.top.nodot("6 ",z6+(1,1));
pair offset; offset=(325,0);
pickup pencircle xscaled .8pt rotated 30;
draw p shifted offset;
makelabel.bot(" 1",z1+offset);
makelabel.bot("2",z2+offset);
makelabel.bot(" 3",z3+offset);
makelabel.top("4 ",z4+offset);
makelabel.top("",z5+offset); makelabel.top.nodot("5",z5+(0,5)+offset);
makelabel.top("",z6+offset); makelabel.top.nodot("6 ",z6+(1,1)+offset);
showit;
shipit;
"Figure 4b"; % T of METAFONT logo
alpha:=.45; % controls bar location and similar things
beta:=.2; % controls squareness of bowls
numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
numeric leftstemloc, barheight;
h#=6; % height of characters, in pt
xx#=0.6; % extra length of certain features, in pt
u#=4/9; % unit width, in pt
s#=0; % extra sidebar, in pt
o#=1/9; % overshoot of curves, in pt
ph#=2/3; % horizontal thickness of pen, in pt
yy#=xx#; define_whole_pixels(xx,yy);
define_pixels(s,u);
define_corrected_pixels(o);
pv#=.9ph#; define_blacker_pixels(ph,pv);
pickup pencircle xscaled ph yscaled pv;
logo_pen:=savepen;
leftstemloc:=good.x((2.5u#+s#)*pt);
barheight:=good.y(alpha*h#*pt);
def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
beginlogochar(T,13);
if odd(w-ph): w:=w+1; fi % allows a symmetric stem
x1+x2=2x3=2x4=w; lft.x1=-epsilon; % I tried s-o instead; was not as good
y1=y2=y3; top.y1=h; bot.y4=-o;
draw z1..z2; draw z3..z4;
labels(1,2,3);
makelabel.top("4",z4);
endchar;
"Figure 4c"; % M of METAFONT logo
alpha:=.45; % controls bar location and similar things
beta:=.2; % controls squareness of bowls
numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
numeric leftstemloc, barheight;
h#=6; % height of characters, in pt
xx#=0.6; % extra length of certain features, in pt
u#=4/9; % unit width, in pt
s#=0; % extra sidebar, in pt
o#=1/9; % overshoot of curves, in pt
ph#=2/3; % horizontal thickness of pen, in pt
yy#=xx#; define_whole_pixels(xx,yy);
define_pixels(s,u);
define_corrected_pixels(o);
pv#=.9ph#; define_blacker_pixels(ph,pv);
pickup pencircle xscaled ph yscaled pv;
logo_pen:=savepen;
leftstemloc:=good.x((2.5u#+s#)*pt);
barheight:=good.y(alpha*h#*pt);
def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
beginlogochar(M,18);
x1+x5=x2+x4=2x3=w; x1=x2=leftstemloc;
y1=y5; y2=y4; bot.y1=-o; top y2=h+o; bot.y3=yy-epsilon;
draw z1--z2--z3--z4--z5;
labels(1,3,5);
makelabel.bot("2",z2);
makelabel.bot("4",z4);
endchar;
"Figure 4d"; % solid kidney bean
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..z1..z3..z6..cycle;
fill p;
makelabel.bot(" 1",z1);
makelabel.bot("2",z2);
makelabel.bot("3 ",z3);
makelabel.top(" 4",z4);
makelabel.top("5",z5);
makelabel.top("6 ",z6);
showit;
shipit;
"Figure 4e"; % black triangle character for exercises
beginchar(oct"170", 5pt#, 6.25pt#, 0);
t:=(2-sqrt3)/2;
x1=x2=w-x3+.5-t=round .43pt; y3=.5+floor.5h; % MANUAL font has it different!
%x1=x2=w-x3=round .43pt; y3=.5+floor.5h;
z1-z2=(z3-z2) rotated 60;
y2:=t+round(y2-t); y1:=h-y2;
fill z1--z2--z3--cycle;
labels(1,2,3); endchar;
"Figure 4f"; % black bean with white holes
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..z1..z3..z6..cycle;
fill p;
unfill 1/4[z4,z2]..3/4[z4,z2]..cycle;
unfill 1/4[z6,z2]..3/4[z6,z2]..cycle;
makelabel.bot(" 1",z1);
makelabel.bot("2",z2);
makelabel.bot("3 ",z3);
makelabel.top(" 4",z4);
makelabel.top("5",z5);
makelabel.top("6 ",z6);
showit;
shipit;
"Figure 4g"; % black bean with skewed interior cutout
clear_all;
z1=(0,100); z2=(100,100); z3=(200,100);
z4=(0,0); z5=(100,0); z6=(200,0);
path p; p=z5..z4..z1..z3..z6..cycle;
fill p;
z0=(.8[x1,x2],.5[y1,y4]);
for k=1 upto 6: z[k]'=.2[z[k],z0]; endfor
unfill z5'..z4'..z1'..z3'..z6'..cycle;
makelabel.bot("0",z0);
makelabel.top("1 ",z1);
makelabel.top("2",z2);
makelabel.top(" 3",z3);
makelabel.bot("4 ",z4);
makelabel.bot("5",z5);
makelabel.bot(" 6",z6);
makelabel.bot(" 1'",z1');
makelabel.bot(" 2'",z2');
makelabel.bot("3' ",z3');
makelabel.top(" 4'",z4');
makelabel.top("5'",z5');
makelabel.top("6' ",z6');
showit;
shipit;
"Figure 4h"; % sample penstroke
clear_all;
penpos1(1.2pt,30); penpos2(1.0pt,45); penpos3(0.8pt,90);
dz2=dz3=right;
z1=(0,2pt); z2=(4pt,0); x3=9pt; y3l=y2r;
penstroke(1,2,3);
penlabels(2,3);
makelabel.lft("1l",z1l);
makelabel.top("1 ",z1);
makelabel.rt("1r",z1r);
showit;
shipit;
"Figure 4i"; % cyclic penstroke example
clear_all;
d:=25;
penpos1(d,30);
penpos2(d,60);
penpos3(d,210);
penpos4(d,240);
y1=.51y2r; y2r=175; y3=.49y2r; y4r=0;
x1r=175; x2=x4=.5x1r; x3r=0;
dz1=up; dz2=left; dz3=down; dz4=right;
penstroke(1,2,3,4,cycle);
penlabels(1,2,3,4);
showit;
shipit;
"Figure 4j"; % T from IOnian font
% Note, I changed the labels of 6 and 6r since the Oct 22 preprint!
clear_all;
em#:=10pt#; cap#:=7pt#;
thin#:=.8pt#;
thick#:=1pt#;
%ff:=6/7; % fudge factor to make this the same size as the T in the logo
%em#:=ff*em#;cap#:=ff*cap#;thin#:=ff*thin#;thick#:=ff*thick#;
define_pixels(em,cap);
define_blacker_pixels(thin,thick);
%beginchar("T",0.75em#,cap#,0); % "The letter T"; % 0044
%beginchar("T",0.7em#,cap#,0); % "The letter T"; % 0039
beginchar("T",0.6em#,cap#,0); % after I got more letters
penpos1(thin,75);
penpos2(thin,72);
penpos3(thin,70);
pentaper2(.4,.6);
x1l=0; y1=y3l;
%x2=.5w; y2=.5[y1,y3]; .2[y2r,y3r]=h;
x2=.5w; y2=.5[y1,y3]; .8[y2r,y3r]=h;
x3=w;
penpos4(thick,argd(z3-z1));
penpos5(thick,20);
penpos6(thick,10);
z2=z4; pentaper4(.25,.1);
x5r=x4r; y5=2/3h;
x6=x5; y6=0;
pentaper5(.4,0);
dz5=down;
penstroke(1,2,3); penstroke(4,5,6);
labels.top(1r,1,5,2r);
labels.lft(1l,5l,4l);
labels.rt(3,3r,5r,4r);
labels.bot(3l,6l,6,6r,2l);
labels(2);
endchar;
"Figure 4k"; % fixed pens versus penstrokes
clear_all;
z1=(0,0); z2=(150,0);
pickup pencircle xscaled 0.8pt rotated 25;
draw z1..z2..cycle;
labels(1,2);
clearxy;
pair offset; offset=(250,0);
penpos1(0.8pt,25); penpos2(0.8pt,25);
z1=0,0)+offset; z2=(150,0)+offset;
penstroke(1,2,cycle);
penlabels(1,2);
showit;
shipit;
"Figure 4l"; % hex symbol with pen-pressure adjustments
%b#:=1.0pt#; define_blacker_pixels(b); % FOR INITIAL TESTS ONLY
%beginchar(0,500/36pt#,250/36pt#,0); % that's magnified 2.5 as in the type
b#:=0.4pt#; define_blacker_pixels(b);
beginchar(0,200/36pt#,100/36pt#,0);
pickup pencircle scaled b;
w:=2good.x .5w;
top z1=(0,h); top z2=(.5w,h); top z3=(w,h);
bot z4=(0,0); bot z5=(.5w,0); bot z6=(w,0);
for k=1 upto 6: filldot z[k]; endfor
z1'=.25[z1,z6]; z6'=.75[z1,z6]; theta1:=argd(z6-z1)+90;
z3'=.25[z3,z4]; z4'=.75[z3,z4]; theta3:=argd(z4-z3)+90;
z7=z8=.5[z1,z6];
penpos1'(b,theta1); penpos6'(b,theta1); penpos7(.6b,theta1);
penpos3'(b,theta3); penpos4'(b,theta3); penpos8(.6b,theta3);
dz1'=dz6'=z6'-z1'; dz3'=dz4'=z4'-z3';
draw z1..z1'; penstroke (1',7,6'); draw z6'..z6;
draw z2..z5;
draw z3..z3'; penstroke (3',8,4'); draw z4'..z4;
%penlabels(1,1',7,2,3,3',8,4,4',5,6,6'); endchar;
penlabels(1',3',4',6');
makelabel.lft("1 ",z1);
makelabel.lft("2 ",z2);
makelabel.rt(" 3",z3);
makelabel.lft("4 ",z4);
makelabel.lft("5 ",z5);
makelabel.rt(" 6",z6);
makelabel.top("8l ",z8l);
makelabel.top(" 7r",z7r);
makelabel.bot("7l ",z7l);
makelabel.bot(" 8r",z8r);
endchar;
"Figure 4m"; % same, cut sharp at the terminals, and inside the box
%b#:=1.0pt#; define_blacker_pixels(b); % FOR INITIAL TESTS ONLY
%beginchar(0,500/36pt#,250/36pt#,0); % that's magnified 2.5 as in the type
b#:=0.4pt#; define_blacker_pixels(b);
beginchar(0,200/36pt#,100/36pt#,0);
pickup pencircle scaled b;
w:=2good.x .5w;
x1l=x4l=0;x2=x5=.5w;x3r=x6r=w;
y1r=y2=y3l=h; y4r=y5=y6l=0;
z1'=.25[z1,z6]; z6'=.75[z1,z6]; theta1:=argd(w,-h)+90;
z3'=.25[z3,z4]; z4'=.75[z3,z4]; theta3:=argd(-w,-h)+90;
z7=z8=.5[z1,z6];
penpos1(b,theta1); penpos6(b,theta1);
penpos1'(b,theta1); penpos6'(b,theta1); penpos7(.6b,theta1);
penpos3(b,theta3); penpos4(b,theta3);
penpos3'(b,theta3); penpos4'(b,theta3); penpos8(.6b,theta3);
dz1'=dz6'=z6'-z1'; dz3'=dz4'=z4'-z3';
penstroke (1,1',7,6',6);
penpos2(b,0); penpos5(b,0); penstroke(2,5);
penstroke (3,3',8,4',4);
%penlabels(1,1',7,2,3,3',8,4,4',5,6,6'); endchar;
penlabels(1,1',2,3,3',4,4',5,6,6');
makelabel.top("8l ",z8l);
makelabel.top(" 7r",z7r);
makelabel.bot("7l ",z7l);
makelabel.bot(" 8r",z8r);
endchar;
"Figure A5a"; % S from IOnian font
clear_all;
em#:=10pt#; cap#:=7pt#;
thin#:=.8pt#;
thick#:=5/6pt#;
o#:=1/5pt#;
define_corrected_pixels(o);
%ff:=6/7; % fudge factor to make this the same size as the T in the logo
%em#:=ff*em#;cap#:=ff*cap#;thin#:=ff*thin#;thick#:=ff*thick#;
define_pixels(em,cap);
define_blacker_pixels(thin,thick);
beginchar("S",5/9em#,cap#,0); % "The letter S"; % 0039
penpos1(thin,70);
penpos2(thin,80);
penpos3(.5[thin,thick],200);
penpos5(.5[thin,thick],210);
penpos6(thin,80);
penpos7(.25[thin,thick],75);
pentaper2(.4,.6); pentaper6(.3,.5);
%x1r=w-.07em; y1r=.95h+o;
x1=x5; y1r=.94h+o;
%x2+.05w=x4=x6-.05w=.5w; y2r=h+o; y4=.54h; y6l=-o;
x2=x4=x6=.5w; y2r=h+o; y4=.54h; y6l=-o;
x3r=.04em; y3=.5[y4,y2];
x5l=w-.03em; y5=.5[y4,y6];
.5[x7l,x7]=.04em; y7l=.1h-o;
path trial; trial=z3{down}..z4..{down}z5;
dz4=direction 1 of trial;
penpos4(thick,argd(dz4)-90);
dz3=dz5=down;
dz2=dz6=left;
penstroke(1,2,3,4,5,6,7);
penlabels(1,2,3,4,5,6);
labels(7l,7r);
labels.lft(7);
endchar;